﻿using CPPEI.WebApi;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using SER = CPPEI.ETL.Domain.Services;
using ENT = CPPEI.ETL.Domain.Entities;
using MOD = CPPEI.ETL.Domain.Models;

namespace CPPEI.ETL.WebApi
{
    [CPPEI.WebApi.AuthPostAction("ETL", "DeleteDataServiceFolder", "1.0")]
    public class DeleteDataServiceFolderAction : BaseAction<DeleteDataServiceFolderParams, DeleteDataServiceFolderResult>
    {
        protected override ActionResult<DeleteDataServiceFolderResult> OnExecute(ActionContext context,
            SysParameters sysParameters,
            DeleteDataServiceFolderParams opParams)
        {
            SER.DtSerService ser = new SER.DtSerService();

            ServiceResult serResult = ser.DeleteFolder(opParams.Id);

            if(serResult.IsSuccess)
            {
                DeleteDataServiceFolderResult result = new DeleteDataServiceFolderResult();

                return new ActionResult<DeleteDataServiceFolderResult>(result);
            }
            else
            {
                return new ActionResult<DeleteDataServiceFolderResult>("1.0", serResult.IsSuccess, serResult.ErrorCode, serResult.Message, null);
            }
        }
    }

    public class DeleteDataServiceFolderParams
    {
        [Parameter]
        public Guid Id { get; set; }
    }

    public class DeleteDataServiceFolderResult
    {
    }
}
